﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;



/*
    
 */

namespace Pitaya_IDE
{
    public partial class menu_bar : Form
    {
        public menu_bar()
        {
            InitializeComponent();
        }
        


        private void Menu_bar_Move(object sender, EventArgs e)
        {
            //if(Form1.label_old!=null)
            //    Form1.label_old.BackColor = Color.FromArgb(150, 150, 150);

            Controls.Clear();

            //if (Form1.label_now == Form1.form_main.label1)
            //{
            //    menu_file();
            //}
        }

        private void Menu_bar_Deactivate(object sender, EventArgs e)
        {
            this.Hide();
            timer1.Enabled = true;
            timer2.Enabled = false;
            Controls.Clear();
            //Form1.label_now.BackColor = Color.FromArgb(150,150,150);
        }


        private void Menu_bar_Activated(object sender, EventArgs e)
        {
            timer2.Enabled = true;
        }

        private void Timer1_Tick(object sender, EventArgs e)
        {
            //Form1.menu_form_vis = 0;
            timer1.Enabled = false;
        }

        private void Timer2_Tick(object sender, EventArgs e)
        {
            //Form1.label_now.BackColor = Color.FromArgb(200, 200, 200);
        }


        private void Label_MouseEnter(object sender, EventArgs e)
        {
            Label label = (Label)sender;
            label.BackColor = Color.FromArgb(33,38,45);
        }

        private void Label_MouseLeave(object sender, EventArgs e)
        {
            Label label = (Label)sender;
            label.BackColor = Color.FromArgb(28, 33, 40);
        }

















/*
    新建文件
    新建窗口
    ---------
    打开文件
    打开最近的文件
    ---------
    保存
    另存为
    全部保存
    ---------
    自动保存
    关闭文件
    关闭远程连接
    ---------
    关闭窗口
    退出
 */
        void menu_file()
        {
            Label new_file = new Label
            {
                Name = "_new_file",
                AutoSize = false,
                Top = 11,
                Left = 2,
                Height = 34
            };
            new_file.Width = this.Width - new_file.Left;
            new_file.ForeColor = Color.FromArgb(201, 209, 217);
            new_file.Text = "    新建文件";
            new_file.Font = new Font("等线", 15);
            new_file.TextAlign = ContentAlignment.MiddleLeft;
            new_file.Cursor = Cursors.Hand;
            new_file.MouseEnter += new EventHandler(Label_MouseEnter);
            new_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(new_file);

            Label new_windown = new Label
            {
                Name = "_new_windown",
                AutoSize = false,
                Top = new_file.Top + new_file.Height + 3,
                Left = 2,
                Height = 34
            };
            new_windown.Width = this.Width - new_windown.Left;
            new_windown.ForeColor = Color.FromArgb(201, 209, 217);
            new_windown.Text = "    新建窗口";
            new_windown.Font = new Font("等线", 15);
            new_windown.TextAlign = ContentAlignment.MiddleLeft;
            new_windown.Cursor = Cursors.Hand;
            new_windown.MouseEnter += new EventHandler(Label_MouseEnter);
            new_windown.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(new_windown);

            Label Line_1 = new Label
            {
                Name = "_line1",
                AutoSize = false,
                Top = new_windown.Top + new_windown.Height + 14,
                Left = 18,
                Height = 1
            };
            Line_1.Width = this.Width - Line_1.Left * 2;
            Line_1.BackColor = Color.FromArgb(86, 89, 93);

            Controls.Add(Line_1);



            Label open_file = new Label
            {
                Name = "_open_file",
                AutoSize = false,
                Top = Line_1.Top + 1 + 10,
                Left = 2,
                Height = 34
            };
            open_file.Width = this.Width - open_file.Left;
            open_file.ForeColor = Color.FromArgb(201, 209, 217);
            open_file.Text = "    打开文件";
            open_file.Font = new Font("等线", 15);
            open_file.TextAlign = ContentAlignment.MiddleLeft;
            open_file.Cursor = Cursors.Hand;
            open_file.MouseEnter += new EventHandler(Label_MouseEnter);
            open_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(open_file);

            Label open_recent_file = new Label
            {
                Name = "_open_recent_file",
                AutoSize = false,
                Top = open_file.Top + open_file.Height + 3,
                Left = 2,
                Height = 34
            };
            open_recent_file.Width = this.Width - open_recent_file.Left;
            open_recent_file.ForeColor = Color.FromArgb(201, 209, 217);
            open_recent_file.Text = "    打开最近文件";
            open_recent_file.Font = new Font("等线", 15);
            open_recent_file.TextAlign = ContentAlignment.MiddleLeft;
            open_recent_file.Cursor = Cursors.Hand;
            open_recent_file.MouseEnter += new EventHandler(Label_MouseEnter);
            open_recent_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(open_recent_file);

            Label Line_2 = new Label
            {
                Name = "_line2",
                AutoSize = false,
                Top = open_recent_file.Top + open_recent_file.Height + 14,
                Left = 18,
                Height = 1
            };
            Line_2.Width = this.Width - Line_2.Left * 2;
            Line_2.BackColor = Color.FromArgb(86, 89, 93);

            Controls.Add(Line_2);

            Label save_file = new Label
            {
                Name = "_save_file",
                AutoSize = false,
                Top = Line_2.Top + 1 + 10,
                Left = 2,
                Height = 34
            };
            save_file.Width = this.Width - save_file.Left;
            save_file.ForeColor = Color.FromArgb(201, 209, 217);
            save_file.Text = "    保存";
            save_file.Font = new Font("等线", 15);
            save_file.TextAlign = ContentAlignment.MiddleLeft;
            save_file.Cursor = Cursors.Hand;
            save_file.MouseEnter += new EventHandler(Label_MouseEnter);
            save_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(save_file);

            Label save_as_file = new Label
            {
                Name = "_save_as_file",
                AutoSize = false,
                Top = save_file.Top + save_file.Height + 3,
                Left = 2,
                Height = 34
            };
            save_as_file.Width = this.Width - save_as_file.Left;
            save_as_file.ForeColor = Color.FromArgb(201, 209, 217);
            save_as_file.Text = "    另存为";
            save_as_file.Font = new Font("等线", 15);
            save_as_file.TextAlign = ContentAlignment.MiddleLeft;
            save_as_file.Cursor = Cursors.Hand;
            save_as_file.MouseEnter += new EventHandler(Label_MouseEnter);
            save_as_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(save_as_file);

            Label all_save = new Label
            {
                Name = "_all_save",
                AutoSize = false,
                Top = save_as_file.Top + save_as_file.Height + 3,
                Left = 2,
                Height = 34
            };
            all_save.Width = this.Width - all_save.Left;
            all_save.ForeColor = Color.FromArgb(201, 209, 217);
            all_save.Text = "    全部保存";
            all_save.Font = new Font("等线", 15);
            all_save.TextAlign = ContentAlignment.MiddleLeft;
            all_save.Cursor = Cursors.Hand;
            all_save.MouseEnter += new EventHandler(Label_MouseEnter);
            all_save.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(all_save);

            Label Line_3 = new Label
            {
                Name = "_line3",
                AutoSize = false,
                Top = all_save.Top + all_save.Height + 14,
                Left = 18,
                Height = 1
            };
            Line_3.Width = this.Width - Line_3.Left * 2;
            Line_3.BackColor = Color.FromArgb(86, 89, 93);

            Controls.Add(Line_3);

            Label auto_save = new Label
            {
                Name = "_auto_save",
                AutoSize = false,
                Top = Line_3.Top + 1 + 10,
                Left = 2,
                Height = 34
            };
            auto_save.Width = this.Width - auto_save.Left;
            auto_save.ForeColor = Color.FromArgb(201, 209, 217);
            auto_save.Text = "    自动保存";
            auto_save.Font = new Font("等线", 15);
            auto_save.TextAlign = ContentAlignment.MiddleLeft;
            auto_save.Cursor = Cursors.Hand;
            auto_save.MouseEnter += new EventHandler(Label_MouseEnter);
            auto_save.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(auto_save);

            Label close_file = new Label
            {
                Name = "_close_file",
                AutoSize = false,
                Top = auto_save.Top + auto_save.Height + 3,
                Left = 2,
                Height = 34
            };
            close_file.Width = this.Width - close_file.Left;
            close_file.ForeColor = Color.FromArgb(201, 209, 217);
            close_file.Text = "    关闭文件";
            close_file.Font = new Font("等线", 15);
            close_file.TextAlign = ContentAlignment.MiddleLeft;
            close_file.Cursor = Cursors.Hand;
            close_file.MouseEnter += new EventHandler(Label_MouseEnter);
            close_file.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(close_file);

            Label close_connect = new Label
            {
                Name = "_close_connect",
                AutoSize = false,
                Top = close_file.Top + close_file.Height + 3,
                Left = 2,
                Height = 34
            };
            close_connect.Width = this.Width - close_connect.Left;
            close_connect.ForeColor = Color.FromArgb(201, 209, 217);
            close_connect.Text = "    关闭远程连接";
            close_connect.Font = new Font("等线", 15);
            close_connect.TextAlign = ContentAlignment.MiddleLeft;
            close_connect.Cursor = Cursors.Hand;
            close_connect.MouseEnter += new EventHandler(Label_MouseEnter);
            close_connect.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(close_connect);

            Label Line_4 = new Label
            {
                Name = "_Line_4",
                AutoSize = false,
                Top = close_connect.Top + close_connect.Height + 14,
                Left = 18,
                Height = 1
            };
            Line_4.Width = this.Width - Line_4.Left * 2;
            Line_4.BackColor = Color.FromArgb(86, 89, 93);

            Controls.Add(Line_4);


            Label close_windown = new Label
            {
                Name = "_close_windown",
                AutoSize = false,
                Top = Line_4.Top + 1 + 10,
                Left = 2,
                Height = 34
            };
            close_windown.Width = this.Width - close_windown.Left;
            close_windown.ForeColor = Color.FromArgb(201, 209, 217);
            close_windown.Text = "    关闭窗口";
            close_windown.Font = new Font("等线", 15);
            close_windown.TextAlign = ContentAlignment.MiddleLeft;
            close_windown.Cursor = Cursors.Hand;
            close_windown.MouseEnter += new EventHandler(Label_MouseEnter);
            close_windown.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(close_windown);

            Label sign_out = new Label
            {
                Name = "_sign_out",
                AutoSize = false,
                Top = close_windown.Top + close_windown.Height + 3,
                Left = 2,
                Height = 34
            };
            sign_out.Width = this.Width - sign_out.Left;
            sign_out.ForeColor = Color.FromArgb(201, 209, 217);
            sign_out.Text = "    退出";
            sign_out.Font = new Font("等线", 15);
            sign_out.TextAlign = ContentAlignment.MiddleLeft;
            sign_out.Cursor = Cursors.Hand;
            sign_out.MouseEnter += new EventHandler(Label_MouseEnter);
            sign_out.MouseLeave += new EventHandler(Label_MouseLeave);

            Controls.Add(sign_out);

            this.Height = sign_out.Top + sign_out.Height + 11;
        }

        private void menu_bar_Load(object sender, EventArgs e)
        {

        }
    }
}
